from flask import Flask
from app.models.book import db

def create_app():
    """
    创建flask实例
    :return:app
    """
    app = Flask(__name__)
    # 导入配置文件
    app.config.from_object('app.secure')
    app.config.from_object('app.setting')
    register_web(app)

    db.init_app(app)
    db.create_all(app=app)
    return app


def register_web(app):
    from app.web.book import web
    app.register_blueprint(web)
